﻿/*===================================================
* CLR版本  : 4.0.30319.42000 
* 类名称   : EntityFactory
* 文 件 名 : EntityFactory 
* 类描述   :
* 创建人   : oream
* 创建时间 : 2018/2/13 21:38:57
* 修改人   : 
* 修改时间 :
* 版本： @version 1.0
=====================================================*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotfix
{
  public static class EntityFactory
  {

    #region Create
    public static T Create<T>() where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      Hotfix.EventSystem.Awake(disposer);
      return disposer;
    }
    public static T Create<T, A>(A a) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      Hotfix.EventSystem.Awake(disposer, a);
      return disposer;
    }
    public static T Create<T, A, B>(A a, B b) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      Hotfix.EventSystem.Awake(disposer, a, b);
      return disposer;
    }
    public static T Create<T, A, B, C>(A a, B b, C c) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      Hotfix.EventSystem.Awake(disposer, a, b, c);
      return disposer;
    }
    #endregion

    #region WithIdCreate

    public static T Create<T>(long id) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      disposer.id = id;
      Hotfix.EventSystem.Awake(disposer);
      return disposer;
    }

    public static T Create<T, A>(long id, A a) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      disposer.id = id;
      Hotfix.EventSystem.Awake(disposer, a);
      return disposer;
    }
    public static T Create<T, A, B>(long id, A a, B b) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      disposer.id = id;
      Hotfix.EventSystem.Awake(disposer, a, b);
      return disposer;
    }
    public static T Create<T, A, B, C>(long id, A a, B b, C c) where T : Disposer
    {
      T disposer = Hotfix.ObjectPool.FetchObject<T>();
      disposer.id = id;
      Hotfix.EventSystem.Awake(disposer, a, b, c);
      return disposer;
    }

    #endregion
  }
}
